import React, { memo, useState } from "react";

const MyButton = memo((props) => {
  const { conf = [] } = props;
  const [active, setActive] = useState(0);
  return (
    <div className="button">
      {conf.map((item, index) => (
        <span
          key={index}
          className={active === index ? "active" : ""}
          onClick={() => setActive(index)}
        >
          {item.type}
        </span>
      ))}
    </div>
  );
});

export default MyButton;
